package xkp.lesson2;

public class TestThreadPriority {
    public static void main(String[] args) {
        //System.out.println(Thread.currentThread().getPriority());
        MyThread myThread0 = new MyThread();
        myThread0.setPriority(Thread.MAX_PRIORITY);
        MyThread myThread1 = new MyThread();
        myThread1.setPriority(Thread.MIN_PRIORITY);

        myThread1.start();
        myThread0.start();


    }
}

class MyThread extends Thread{
    @Override
    public void run() {
       // System.out.println(Thread.currentThread().getPriority()+"线程优先级");
        for(int i = 1; i <= 10; i++){
            System.out.println(i+":"+Thread.currentThread().getName());
            try {
                Thread.sleep(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
